package com.yonyou.brigade.third_parties.ctrip.bigcustomer.service.impl;

import com.yonyou.brigade.third_parties.ctrip.bigcustomer.model.CtripPostDictionaries;
import com.yonyou.brigade.third_parties.ctrip.bigcustomer.dao.CtripPostDictionariesMapper;
import com.yonyou.brigade.third_parties.ctrip.bigcustomer.service.ICtripPostDictionariesService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jiangzhf@yonyou.com
 * @since 2018-08-17
 */
@Service
public class CtripPostDictionariesServiceImpl extends ServiceImpl<CtripPostDictionariesMapper, CtripPostDictionaries> implements ICtripPostDictionariesService {

    @Autowired
    private CtripPostDictionariesMapper ctripPostDictionariesMapper;

    public CtripPostDictionaries findPostByPostname(Map params)
    {
        return  ctripPostDictionariesMapper.findPostByPostname(params);
    }

    public  CtripPostDictionaries findDefaultPost(Map params)
    {
        return  null;
    }

    public CtripPostDictionaries getPostDictionaries(String postName) {
        CtripPostDictionaries ctripPostDictionaries =null;
        if(!StringUtils.isEmpty(postName)) {
            Map params=new HashMap();
            params.put("postName",postName);
            ctripPostDictionaries = ctripPostDictionariesMapper.findPostByPostname(params);
        }
        if (ctripPostDictionaries==null){
            Map params=new HashMap();
//            ctripPostDictionaries = ctripPostDictionariesMapper.findPostByPostname("未知职务");
            ctripPostDictionaries = ctripPostDictionariesMapper.findDefaultPost(params);
        }
        return  ctripPostDictionaries;
    }


}
